package com.xmx.dao;

import com.xmx.domain.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 用户的持久层接口
 * @Author Xumx
 * @Date 2021/3/15 11:13
 * @Version 1.0
 */
public interface IUserDao {

    /*
    *  查询用户列表
    * */
    @Select("select * from user")
    List<User> findAll();

    /*
    *   根据id查询
    * */
    @Select("select * from user where id = #{userId}")
    User findById(Integer userId);

    /*
    *   更新用户
    * */
    @Update("update user set username=#{username},password=#{password},age=#{age},sex=#{sex},email=#{email} where id = #{id}")
    void updateUser(User user);
}
